package patterns.absfactory;

/**
 * Created by lenovo on 2016/11/22 0022.
 * 演示使用抽象工厂类
 */
public class AbstractFactoryPatternDemo {
    public static void main(String[] args){
        //获取不同模式的工厂对象
        AbstractFactory shapeFactory = FactoryProducer.getFactory("shape");
        AbstractFactory colorFactory = FactoryProducer.getFactory("color");
        //根据不同的工厂，获取对应的接口实例对象，然后在调用不同的对象的方法。多态形式。

        IShape rect = shapeFactory.getShape("rect");
        rect.draw();

        IColor red = colorFactory.getColor("red");
        red.fill();
    }
}
